<p>If the denominator to a division or modulo operation is zero it would result in a fatal error.</p>
<p>When working with <code>double</code> or <code>float</code>, no fatal error will be raised, but it will lead to unusual result and should be
avoided anyway.</p>
<p>This rule supports primitive <code>int</code>, <code>long</code>, <code>double</code>, <code>float</code> as well as <code>BigDecimal</code> and
<code>BigInteger</code>.</p>
<h2>Noncompliant Code Example</h2>
<pre>
void test_divide() {
  int z = 0;
  if (unknown()) {
    // ..
    z = 3;
  } else {
    // ..
  }
  z = 1 / z; // Noncompliant, possible division by zero
}
</pre>
<h2>Compliant Solution</h2>
<pre>
void test_divide() {
  int z = 0;
  if (unknown()) {
    // ..
    z = 3;
  } else {
    // ..
    z = 1;
  }
  z = 1 / z;
}
</pre>
<h2>See</h2>
<ul>
  <li> <a href="https://cwe.mitre.org/data/definitions/369.html">MITRE, CWE-369</a> - Divide by zero </li>
  <li> <a href="https://wiki.sei.cmu.edu/confluence/x/CTZGBQ">CERT, NUM02-J.</a> - Ensure that division and remainder operations do not result in
  divide-by-zero errors </li>
  <li> <a href="https://wiki.sei.cmu.edu/confluence/x/ftYxBQ">CERT, INT33-C.</a> - Ensure that division and remainder operations do not result in
  divide-by-zero errors </li>
</ul>

